//
//  UIBarbuttonItem+extesion.swift
//  SinaWeibo
//
//  Created by 美食家 on 17/3/29.
//  Copyright © 2017年 不孤独的美食家. All rights reserved.
//

import UIKit

extension UIBarButtonItem{

    convenience init(title:String,fontSize:CGFloat=16,target:AnyObject?,action:Selector,isBack:Bool=false) {
        
        let btn: UIButton=UIButton.cz_textButton(title, fontSize: fontSize, normalColor: UIColor.red, highlightedColor: UIColor.orange)
        
        
        if  isBack{
        
            let imageName="navigationbar_back_withtext"
            btn.setImage(UIImage(named:imageName), for: .init(rawValue: 0))
            btn.setImage(UIImage(named:"navigationbar_back_withtext_highlighted"), for: .highlighted)
            btn.sizeToFit()
        }
        
        btn.addTarget(target, action:action, for: .touchUpInside)
        
        
        self.init(customView:btn)
    }
}
